package com.ticket.sass.admin.dto.output.cinema;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.ticket.sass.admin.dto.output.config.TicketServerConfigOutput;
import com.ticket.sass.admin.model.KeyInfoModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * @author ywb
 * @date 2024-03-15 15:38
 */
@Data
@ApiModel
public class CinemaListOutput {
    private Long id;
    
    @NotBlank(message = "影院名称不能为空")
    @ApiModelProperty(value = "影院名称", required = true)
    private String name;
    
    @ApiModelProperty(value = "影院简称", required = true)
    private String shortName;
    
    @ApiModelProperty(value = "专资编码")
    private String zzCode;
    
    @ApiModelProperty(value = "经度")
    private Double lng;
    @JsonIgnore
    @ApiModelProperty(value = "影院LOGO")
    private String logo;
    
    @ApiModelProperty(value = "影院LOGO")
    private KeyInfoModel logoModel;
    
    @ApiModelProperty(value = "纬度")
    private Double lat;
    
    @ApiModelProperty(value = "区域编码")
    private String areaCode;
    
    @ApiModelProperty(value = "地址", required = true)
    private String addr;
    
    @ApiModelProperty(value = "地区")
    private String area;
    
    @ApiModelProperty(value = "联系方式")
    private List<String> contact;
    
    @ApiModelProperty(value = "售票系统", required = true)
    private TicketServerConfigOutput ticketServerConfig;
    
    public KeyInfoModel getLogoModel() {
        if (Objects.isNull(logo)){
            return null;
        }
        
        return new KeyInfoModel(logo.toString());
    }
    
    public List<String> getContact() {
        if (Objects.isNull(contact)){
            return new ArrayList<>();
        }
        return contact;
    }
}
